<?php 
namespace lib;
use lib\{Order_Template};
class MsgNotice {
    protected $conf;
    protected $httphost;
    protected $Order_Temp;
   public function __construct($conf){
       $this->conf = $conf;
       $this->httphost = $this->conf->localurl;
       $this->Order_Temp = new Order_Template();
   }
   
   public function send($scene, $user, $data){
       if(method_exists($this, $scene)) {
           return $this->$scene($user, $data);
       }
       return false;
   }
   
   public function work($user, $data){
       $data = [
           'user' => $user,
           'paragraphs' => [
               ['label' => '【'.$this->conf['sitename'].'】对你的工单进行了回复'],
               ['label' => '工单编号为：', 'value' => $data['num'].'的工单已经有最新的进展啦！','fontSize'=>'12'], 
               ['label' => '请尽快登录网站查看详细内容', 'value' => '【<a href="'.$this->httphost.'" target="_blank">登录网站</a>】<br/>','fontSize'=>'12'],
           ]
       ];
       $msg = Mailbox_sending_template($data, '工单回复');
       return $msg;
   }
   public function userwork($user , $data){
       $data = [
            'user' => $user,
            'paragraphs' => [
                ['label' => '新的工单等您来处理！'],
                ['label' => '尊敬的管理员您的网站【'.$this->conf['sitename'].'】收到一个工单'],
                ['label' => '工单编号为：', 'value' => $data['num'],'fontSize'=>'12'],
                ['label' => '工单类型为：', 'value' => $data['types'],'fontSize'=>'12'],
                ['label' => '工单标题为：', 'value' => $data['biaoti'],'fontSize'=>'12'],
                ['label' => '请尽快登录后台处理工单', 'fontSize'=>'12'],
            ]
        ];
       $msg = Mailbox_sending_template($data, '新工单消息');
       return $msg;
   }
   public function code($user , $data){
       $data = [
           'user' => $user,
           'paragraphs' => [
               ['label' => '您的验证码是：', 'value' => $data['code'],'fontSize'=>'12'], 
               ['label' => '如非本人操作 那您的账号可能造成的泄露 请尽快修改密码', 'value' => '【<a href="'.$this->httphost.'" target="_blank">登录网站</a>】<br/>','fontSize'=>'12'],
           ]
       ];
       $msg = Mailbox_sending_template($data, '验证码获取');
       return $msg;
   }
   public function Retrieve($user , $url){
       $data = [
           'user' => $user,
           'paragraphs' => [
               ['label' => '您的重置链接是：','value'=>'【<a href="'.$url.'" target="_blank">点击跳转</a>】'], 
               ['label' => '该链接在30分钟内有效！'], 
               ['label' => '前往登录->', 'value' => '【<a href="'.$this->httphost.'" target="_blank">登录网站</a>】<br/>','fontSize'=>'12'],
           ]
       ];
       $msg = Mailbox_sending_template($data, '密码重置');
       return $msg;
   }
   public function reg($user , $data){
       $data = [
           'user' => $user,
           'paragraphs' => [
               ['label' => '恭喜您注册成功！'], 
               ['label' => '您的账号是：','value'=>$data['user']], 
               ['label' => '您的商户号是：','value'=>$data['pid']], 
               ['label' => '前往登录->', 'value' => '【<a href="'.$this->httphost.'" target="_blank">登录网站</a>】<br/>','fontSize'=>'12'],
           ]
       ];
       $msg = Mailbox_sending_template($data, '验证码获取');
       return $msg;
   }
   public function Drop_Notify($user, $type){
       $data = [
           'user' => $this->conf->sitename . '用户',
           'paragraphs' => [
               ['label' => '您在本站挂的', 'value' => "[$type]" . 'COOKIE失效了,为了不影响您继续使用,请及时去更新','fontSize'=>'12'], 
               ['label' => '地址->', 'value' => '【<a href="'.$this->httphost.'" target="_blank">登录网站</a>】<br/>','fontSize'=>'12'],
           ]
       ];
       $msg = Mailbox_sending_template($data, '掉线通知');
       return $msg;
   }
   public function fkjk($row , $title){
       $data = [
           'user' => $this->conf->sitename . '用户',
           'paragraphs' => [
               ['label' => '您的账号', 'value' => "[{$row['user']}]" . '下的二维码经系统检测'], 
               ['label' => '您的二维码ID', 'value' => "[{$row['id']}]" . '疑似被风控'],
               ['label' => '本系统已自动将您的此二维码改变为掉线状态，如确认无异常，可在商户中心修改您的此二维码为正常即可，其次在12小时内请勿打开风控检测，否则将会继续风控！','fontSize'=>'12'],
               ['label' => '支付地址->', 'value' => '【<a href="'.$this->httphost.'" target="_blank">登录网站</a>】<br/>','fontSize'=>'12'],
           ]
       ];
       $msg = Mailbox_sending_template($data, $title);
       return $msg;
   }
   public function user_vip_email($row , $title){
       $data = [
           'user' => $this->conf->sitename . '用户',
           'paragraphs' => [
               ['label' => '您的账号', 'value' => "[{$row['user']}]" . '有会员已过期'], 
               ['label' => '请及时续费否则会影响您的正常使用！'],
               ['label' => '站点地址->', 'value' => '【<a href="'.$this->httphost.'" target="_blank">登录网站</a>】<br/>','fontSize'=>'12'],
           ]
       ];
       $msg = Mailbox_sending_template($data, $title);
       return $msg;
   }
}
?>